<?php
/**
 * Created by PhpStorm.
 * User: skytop
 * Date: 2016/7/19
 * Time: 11:42
 */
function phiz($content){
    $pin=array(
        'zhuakuang'=>"抓狂",
        'baobao'=>"抱抱",
        'haixiu'=>"害羞",
        "ku"=>"酷",
        "xixi"=>"嘻嘻",
        "taikaixin"=>"太开心",
        "touxiao"=>"偷笑",
        "qian"=>"钱",
        "huaxin"=>"花心",
        "jiyan"=>"挤眼"
    );
    preg_match_all('/\[.*?\]/is',$content,$a);
    if($a[0]){
        foreach($a[0] as $v){
            foreach($pin as $k=>$val){
                if($v=='['.$val.']'){
                    $content=str_replace($v,"<img src=\"".__ROOT__."/Public/Images/phiz/".$k.'.gif'."\"/>",$content);
                }
                continue;
            }
        }
    }
    return $content;
}